package com.example.myapplication.Activity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import com.example.myapplication.R;

public class Main2Activity extends AppCompatActivity {

    private TextView lufei;
    private RadioGroup radioGroup;
    private RadioButton rbShitou;
    private RadioButton rbQiandao;
    private RadioButton rbBu;
    private Button button;
    private ImageView m21Back;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);
        initView();
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                intentString();
                finish();
            }
        });

    }

    /*
    跳转传值
     */
    public void intentString() {
        RadioButton radioButton = (RadioButton) this.findViewById(radioGroup.getCheckedRadioButtonId());
        String game = radioButton.getText().toString();
        startActivity(new Intent(this, Main2Activity2.class).putExtra("game", game));
        Log.d("ddddd", "intentString1: " + game);
    }

    /*
    初始化控件
     */
    private void initView() {
        lufei = (TextView) findViewById(R.id.lufei);
        radioGroup = (RadioGroup) findViewById(R.id.radioGroup);
        rbShitou = (RadioButton) findViewById(R.id.rb_shitou);
        rbQiandao = (RadioButton) findViewById(R.id.rb_qiandao);
        rbBu = (RadioButton) findViewById(R.id.rb_bu);
        button = (Button) findViewById(R.id.button);
        m21Back = (ImageView) findViewById(R.id.m21_back);
        m21Back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }
}
